<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" media="screen" type="text/css" href="__THEMES__/style/layout.css" />
		<script type="text/javascript" src="__JS__/jQuery/jquery.js"></script>
		<script type="text/javascript" src="__JS__/jQuery/plugin/troperate.js"></script>
		<script type="text/javascript" src="__JS__/jQuery/plugin/alertbox.js"></script>
		<include file="Public:js_artDialog" />
		<script type="text/javascript">
            $(function(){
                $("#add_resume").click(function(){
                    var $_type = $(this).attr('rel');
                   	art.dialog.loadCall('__URL__/add/type/'+$_type,{
						title : $(this).val(),
						lock : true
					}, false, function(){
						var ic = $('body',parent.document).find('#add_'+$_type+'_submit');
						ic.submit(function(){
							switch ( $_type ){
								case 'myinfo' :
									if (initCheck( ic, '#resume_key', '名称必须！' )==false) return false;
									if (initCheck( ic, '#resume_value', '内容必须！' )==false) return false;
								break;
								case 'exp_work' :
									if (initCheck( ic, '#title', '工作经历标题必须！' )==false) return false;
								break;
								case 'project' :
									if (initCheck( ic, '#title', '项目名称必须！' )==false) return false;
								break;
								case 'education' :
									if (initCheck( ic, '#title', '学校名称必须！' )==false) return false;
								break;
								case 'skill' :
									if (initCheck( ic, '#title', '技能类型必须，例如：“编程开发：”！' )==false) return false;
									if (initCheck( ic, '#resume_key', '技能名称必须！' )==false) return false;
								break;
							}
							$.post('__URL__/insert',ic.serialize(),function(c){
								setAlertBox(c.info, 2);
								if ( c.status === 0 ){
									return false;
								}else{
									window.location.reload();
								}
							},'json');
							return false;
						});
					});
                    return false;
                });
                
                $('.edit_resume').click(function(){
                	var type = $(this).attr('rel');
					var url = $(this).attr('href');
					art.dialog.loadCall(url,{
						title : '编辑',
						lock : true
					}, false, function(){
						var ic = $('body',parent.document).find('#edit_'+type+'_submit');
						ic.submit(function(){
							switch ( type ){
								case 'myinfo' :
									if (initCheck( ic, '#resume_key', '名称必须！' )==false) return false;
									if (initCheck( ic, '#resume_value', '内容必须！' )==false) return false;
								break;
								case 'exp_work' :
									if (initCheck( ic, '#title', '工作经历标题必须！' )==false) return false;
								break;
								case 'project' :
									if (initCheck( ic, '#title', '项目名称必须！' )==false) return false;
								break;
								case 'education' :
									if (initCheck( ic, '#title', '学校名称必须！' )==false) return false;
								break;
								case 'skill' :
									if (initCheck( ic, '#title', '技能类型必须，例如：“编程开发：”！' )==false) return false;
									if (initCheck( ic, '#resume_key', '技能名称必须！' )==false) return false;
								break;
							}
							$.post('__URL__/update',ic.serialize(),function(c){
								setAlertBox(c.info, 2);
								if ( c.status === 0 ){
									return false;
								}else{
									window.location.reload();
								}
							},'json');
							return false;
						});
					});
					return false;
				});
            });
            
            function initCheck( Dom, ID, val ){
            	if ( Dom.find(ID).val() == '' ){
					setAlertBox(val, 2);
					Dom.find(ID).addClass('errorInput').focus();
					return false;
				}
            }
        </script>
		<style type="text/css">
			table			{ background:#fff; }
			table td		{ padding:7px 5px; border-color:#ddd; }
		</style>
	</head>
	<body>
		<include file="Public:position" />
		<div class="button">
			<?php
				$add_val = $this_class = $link_1 = '';
				foreach ( $type_list as $ckey => $cval ){
					if ( $cval['type'] == $type ){
						$add_val = $cval['name'];
						$this_class = ' class="this"';
					}else{
						$this_class = '';
					}
					$link_1 .= '<li'.$this_class.'><a href="'.U('index',array('tag'=>$_GET['tag'],'type'=>$cval['type'])).'">'.$cval['name'].'</a></li>';
				}
			?>
            <input type="button" value="新增{$add_val}" class="submit" id="add_resume" rel="{$type}" />
        </div>
    	
    	<ul class="act_this">
            {$link_1}
        </ul>
        
        <div class="a_table" style="margin-top:-1px; _margin-top:-2px; padding: 10px; background:#f9f9f9; border:1px solid #eee;">
	    	<table width="100%">
                <volist name="resume_list" id="val">
                <?php
                    switch ($type){
                        case 'myinfo' :
                ?>
                <tr class="row_color"<?php if( ( $i % 2 ) == 0 ){ ?> bgcolor="#f9f9f9"<?php } ?>>
                    <td align="right" width="90" class="left_text">{$val.resume_key}</td>
                    <td align="left">{$val.resume_value}</td>
                    <td width="90" align="center"><a href="{:U('edit',array('id'=>$val['id'],'type'=>$val['type']))}" class="edit_resume" rel="{$val.type}">编辑</a><span class="action_line">|</span><a href="{:U('delete',array('id'=>$val['id']))}">删除</a></td>
                </tr>
                <?php
                            break;
                        
                        case 'exp_work' : 
                ?>
                <tr class="row_color"<?php if( ( $i % 2 ) == 0 ){ ?> bgcolor="#f9f9f9"<?php } ?>>
                    <td align="right" class="left_text">{$val.title}</td>
                    <td align="left">{$val.content}</td>
                    <td align="center" width="120">{$val.start_time}</td>
                    <td align="center" width="120">{$val.end_time}</td>
                    <td width="90" align="center"><a href="{:U('edit',array('id'=>$val['id'],'type'=>$val['type']))}" class="edit_resume" rel="{$val.type}">编辑</a><span class="action_line">|</span><a href="{:U('delete',array('id'=>$val['id']))}">删除</a></td>
                </tr>
                <?php
                            break;
                            
                        case 'project' :
                ?>
                <tr class="row_color"<?php if( ( $i % 2 ) == 0 ){ ?> bgcolor="#f9f9f9"<?php } ?>>
                    <td align="right" class="left_text">{$val.title}</td>
                    <td align="left">{$val.content}</td>
                    <td align="center"><a href="{$val.url}" target="_blank">{$val.url}</a></td>
                    <td width="90" align="center"><a href="{:U('edit',array('id'=>$val['id'],'type'=>$val['type']))}" class="edit_resume" rel="{$val.type}">编辑</a><span class="action_line">|</span><a href="{:U('delete',array('id'=>$val['id']))}">删除</a></td>
                </tr>
                <?php
                            break;
                        
                        case 'education' : 
                ?>
                <tr class="row_color"<?php if( ( $i % 2 ) == 0 ){ ?> bgcolor="#f9f9f9"<?php } ?>>
                    <td align="center" class="left_text">{$val.title}</td>
                    <td align="center">{$val.start_time}</td>
                    <td align="center">{$val.end_time}</td>
                    <td width="90" align="center"><a href="{:U('edit',array('id'=>$val['id'],'type'=>$val['type']))}" class="edit_resume" rel="{$val.type}">编辑</a><span class="action_line">|</span><a href="{:U('delete',array('id'=>$val['id']))}">删除</a></td>
                </tr>
                <?php
                            break;
                            
                        case 'skill' : 
                ?>
                <tr class="row_color"<?php if( ( $i % 2 ) == 0 ){ ?> bgcolor="#f9f9f9"<?php } ?>>
                    <td class="left_text" align="right">{$val.title}</td>
                    <td class="left_text">{$val.resume_key}</td>
                    <td align="center">{$val.resume_value}</td>
                    <td align="center">{$val.content}</td>
                    <td width="90" align="center"><a href="{:U('edit',array('id'=>$val['id'],'type'=>$val['type']))}" class="edit_resume" rel="{$val.type}">编辑</a><span class="action_line">|</span><a href="{:U('delete',array('id'=>$val['id']))}">删除</a></td>
                </tr>
                <?php
                            break;
                    }
                ?>
                </volist>
            </table>
        </div>
	</body>
</html>